package com.qcby.demo.proxyaop.proxy.jdk;

import com.qcby.demo.proxyaop.proxy.star.JiaLing;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @className: AdvertisementHandler
 * @description: 广告代理类
 * @author: lxt
 * @create: 2021-05-12 15:30
 **/
@Slf4j
public class AdvertisementHandler implements InvocationHandler {

    private Object object;

    // 经纪人和贾玲建立关系
    public AdvertisementHandler(Object object) {
        this.object = object;
    }
    // 覆写接口的方法
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        log.info("贾玲的代理正在与您沟通【广告代言】...");
        method.invoke(object,args);
        log.info("贾玲的代理正在完成收尾【广告代言】...");
        return null;
    }
}
